home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGNG_C / CFUNCTS.LZH / POKE.C < prev    next >
Text File  |  1987-01-22  |  2KB  |  40 lines

  1.      /*
  2.      ===================================================================
  3.                      P O K E   F U N C T I O N
  4.      ===================================================================
  5.      This function will poke a value into a screen memory
  6.      location. It is passed the row and column and the
  7.      desired value to poke. It will then calculate the
  8.      address of the screen location and then store the
  9.      value at that address.
  10.      -----------------------------------------------------------------*/
  11.      poke(row,col,val)
  12.      int row, col;
  13.      char val;
  14.      {
  15.      char far *loc;               /* memory location pointer.         */
  16.      int card_type;               /* card type?                       */
  17.      int position;                /* cursor position.                 */
  18.  
  19.           card_type = card();
  20.           if(card_type == 1){     /* IBM Color Card.                  */
  21.             loc = (char far *)0xb8000000;
  22.           }
  23.           else{                   /* Monochrome card.                 */
  24.             loc = (char far *)0xb0000000;
  25.           }
  26.  
  27.                                   /* Determine cursor position.       */
  28.           position = ((row * 80) + col) * 2;
  29.  
  30.                                   /* Add position to loc.             */
  31.           loc += position;
  32.  
  33.                                   /* Store val at loc address.        */
  34.           *loc++ = val;
  35.           *loc = 0x07;            /* Normal attribute.                */
  36.  
  37.           return(0);              /* All done. Let's exit poke().     */
  38.      }
  39.      /*---------------------------------------------------------------*/
  40.